﻿<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Pragma" content="no-cache">
<link rel="STYLESHEET" type="text/css" id="SkinStyleSheet">
<title>WebNoteEditor</title>
<style type="text/css">
#btnMoveUp{background-image:url('../images/arrow_up.gif');background-repeat:no-repeat;padding-left:20px;}
#btnMoveDown{background-image:url('../images/arrow_down.gif');background-repeat:no-repeat;padding-left:20px;}
#btnDelete{background-image:url('../images/delete.gif');background-repeat:no-repeat;padding-left:20px;}
#selectAbsolutePage{width:360px;}
#inputPageTitle{width:360px;height:18px}
</style>
<script language="javascript" type="text/javascript" src="../script/windialog.js"></script>
<!--<script language="javascript" type="text/javascript" src="../script/ie2w3c-min.js"></script>-->
<script language="javascript" type="text/javascript" src="../script_bak/ie2w3c.js"></script>
<script type="text/javascript">
var parentAbsolutePage;
var currentPage;
window.onload=function()
{
	EditorWindow.renderWindowAsIE(window);

	document.getElementById("btnMoveUp").value=EditorWindow.lang_up;
	document.getElementById("btnMoveUp").onclick=__btnMoveUp_onclick;
	document.getElementById("btnMoveDown").value=EditorWindow.lang_down;
	document.getElementById("btnMoveDown").onclick=__btnMoveDown_onclick;
	document.getElementById("btnDelete").value=EditorWindow.lang_delete;
	document.getElementById("btnDelete").onclick=__btnDelete_onclick;
	document.getElementById("btnModifyPageTitle").value=EditorWindow.lang_modifypagetitle;
	document.getElementById("btnModifyPageTitle").onclick=__btnModifyPageTitle_onclick;
	
	
	parentAbsolutePage=EditorWindow.document.getElementById("absolutepage");

	var i,elem;
	
	parentAbsolutePage.options[parentAbsolutePage.selectedIndex].setAttribute("pagetitle",EditorWindow.document.getElementById("pagetitle").value);
	parentAbsolutePage.options[parentAbsolutePage.selectedIndex].setAttribute("html",EditorWindow.getHTML());
	
	for (i=0;i<parentAbsolutePage.options.length;i++)
	{
		elem=document.createElement("option");
		elem.value=parentAbsolutePage.options[i].value;
		elem.innerText=parentAbsolutePage.options[i].innerText+")"+parentAbsolutePage.options[i].getAttribute("pagetitle");
		elem.setAttribute("pagetitle",parentAbsolutePage.options[i].getAttribute("pagetitle"));
		elem.setAttribute("html",parentAbsolutePage.options[i].getAttribute("html"));
		document.getElementById("selectAbsolutePage").appendChild(elem);
		//elem=null;
	}
	
	document.getElementById("selectAbsolutePage").onchange=__selectAbsolutePage_onchange;
	currentPage=EditorWindow.getAbsolutePage();

	AutoResizeDialogWindow();
}

function __btnOk_onclick()
{

	var i,elem,elems;

	for(i=0;i<parentAbsolutePage.options.length;i++)
	{
		parentAbsolutePage.options[i].innerHTML="";
		parentAbsolutePage.options[i].removeNode();
		i--;
	}
	elems=document.getElementById("selectAbsolutePage").options;
	for(i=0;i<elems.length;i++)
	{
		elem=EditorWindow.document.createElement("option");
		elem.value=elems[i].value
		elem.innerText=elems[i].value
		elem.setAttribute("pagetitle",elems[i].getAttribute("pagetitle"));
		elem.setAttribute("html",elems[i].getAttribute("html"));
		//alert(i+"\n"+elems[i].getAttribute("pagetitle")+"\n"+elems[i].getAttribute("html"));
		parentAbsolutePage.appendChild(elem);
		elem=null;
	}
	
	
	if (currentPage>document.getElementById("selectAbsolutePage").options.length)
		currentPage=1;

	//EditorWindow.gotoAbsolutePage(currentPage);
	parentAbsolutePage.options[currentPage-1].selected=true;
	
	EditorWindow.setHTML(elems[currentPage-1].getAttribute("html"));
	
	
	EditorWindow.document.getElementById("pagetitle").value=elems[currentPage-1].getAttribute("pagetitle");
	
	elems=null;
	window.close();
}


function __btnCancel_onclick()
{
	window.close();
}

function __selectAbsolutePage_onchange()
{
	document.getElementById("inputPageTitle").value=document.getElementById("selectAbsolutePage").options[document.getElementById("selectAbsolutePage").selectedIndex].getAttribute("pagetitle");

	if (document.getElementById("inputPageTitle").value=="null")
		document.getElementById("inputPageTitle").value="";

}


function __btnMoveUp_onclick()
{
	if (document.getElementById("selectAbsolutePage").selectedIndex>0)
	{
		with (document.getElementById("selectAbsolutePage").children[document.getElementById("selectAbsolutePage").selectedIndex])
		{
			value=parseInt(value)-1
			innerText=value+") "+getAttribute("pagetitle");
		}
		with (document.getElementById("selectAbsolutePage").children[document.getElementById("selectAbsolutePage").selectedIndex-1])
		{
			value=parseInt(value)+1;
			innerText=value+") "+getAttribute("pagetitle");
		}
	
		document.getElementById("selectAbsolutePage").children[document.getElementById("selectAbsolutePage").selectedIndex].swapNode(document.getElementById("selectAbsolutePage").children[document.getElementById("selectAbsolutePage").selectedIndex-1]);
	}

}

function __btnMoveDown_onclick()
{
	if (document.getElementById("selectAbsolutePage").selectedIndex>=0 && document.getElementById("selectAbsolutePage").selectedIndex<document.getElementById("selectAbsolutePage").length-1)
	{
		with (document.getElementById("selectAbsolutePage").children[document.getElementById("selectAbsolutePage").selectedIndex])
		{
			value=parseInt(value)+1
			innerText=value+") "+getAttribute("pagetitle");
		}
		with (document.getElementById("selectAbsolutePage").children[document.getElementById("selectAbsolutePage").selectedIndex+1])
		{
			value=parseInt(value)-1;
			innerText=value+") "+getAttribute("pagetitle");
		}
	
		document.getElementById("selectAbsolutePage").children[document.getElementById("selectAbsolutePage").selectedIndex].swapNode(document.getElementById("selectAbsolutePage").children[document.getElementById("selectAbsolutePage").selectedIndex+1]);
	}

}

function __btnDelete_onclick()
{
	var selectedIndex,i;
	selectedIndex=document.getElementById("selectAbsolutePage").selectedIndex;
	if (selectedIndex>=0 && document.getElementById("selectAbsolutePage").options.length>1)
	{
		document.getElementById("selectAbsolutePage").removeChild(document.getElementById("selectAbsolutePage").children[selectedIndex]);
		for (i=selectedIndex;i<=document.getElementById("selectAbsolutePage").options.length-1;i++)
		{
			with (document.getElementById("selectAbsolutePage").options[i])
			{
				value=value-1
				innerText=value+")"+getAttribute("pagetitle");
			}
		}
	}

}

function __btnModifyPageTitle_onclick()
{
	if (document.getElementById("selectAbsolutePage").selectedIndex>=0 && document.getElementById("selectAbsolutePage").selectedIndex<document.getElementById("selectAbsolutePage").length)
	{
		
		document.getElementById("selectAbsolutePage").options[document.getElementById("selectAbsolutePage").selectedIndex].innerText=document.getElementById("selectAbsolutePage").options[document.getElementById("selectAbsolutePage").selectedIndex].value+")"+document.getElementById("inputPageTitle").value;
		document.getElementById("selectAbsolutePage").options[document.getElementById("selectAbsolutePage").selectedIndex].setAttribute("pagetitle",document.getElementById("inputPageTitle").value);
		
		
	}
}

</script>
</head>

<body class="dialog">
<script language="javascript" type="text/javascript">dialogTitle("lang_pageadmin");</script>

<table border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td valign="top"><select id="selectAbsolutePage" size="10" multiple="multiple"></select></td>
		<td valign="top" style="padding-left:10px">
			<input type="button" value="" id="btnMoveUp" class="SysBTN5"><br>
			<input type="button" value="" id="btnMoveDown" class="SysBTN5"><br>
			<input type="button" value="" id="btnDelete" class="SysBTN5">
		</td>
	</tr>
	<tr>
		<td valign="top" style="padding-top:6px"><input type="text" id="inputPageTitle"></td>
		<td valign="top" style="padding-left:10px"><input type="button" value="" id="btnModifyPageTitle" class="SysBTN5"></td>
	</tr>
</table>

<div class="buttons">
	<hr size="1" color="#B3AC9D">
	<script language="javascript" type="text/javascript">PrintButtons2();</script>
</div>

</body>

</html>

